package cn.iocoder.yudao.module.ao.dal.mysql.building;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.building.BuildingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.building.vo.*;

/**
 * 建筑物信息 Mapper
 *
 * @author 智教云枢
 */
@Mapper
public interface BuildingMapper extends BaseMapperX<BuildingDO> {

    default PageResult<BuildingDO> selectPage(BuildingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BuildingDO>()
                .eqIfPresent(BuildingDO::getSchoolId, reqVO.getSchoolId())
                .likeIfPresent(BuildingDO::getBuildingName, reqVO.getBuildingName())
                .eqIfPresent(BuildingDO::getBuildingCode, reqVO.getBuildingCode())
                .eqIfPresent(BuildingDO::getBuildingType, reqVO.getBuildingType())
                .eqIfPresent(BuildingDO::getFloorCount, reqVO.getFloorCount())
                .eqIfPresent(BuildingDO::getAddress, reqVO.getAddress())
                .eqIfPresent(BuildingDO::getManagerId, reqVO.getManagerId())
                .eqIfPresent(BuildingDO::getDescription, reqVO.getDescription())
                .eqIfPresent(BuildingDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BuildingDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(BuildingDO::getBuildingId));
    }

}